package com.tzl.design_pattern.singleton_pattern;

/**
 * @author Zhilei Tang
 * @date Created in 2020/11/15 13:50
 */
public class SingletonTest {
  public static void main(String[] args) {
    new Thread(() -> System.out.println(HungrySingleton.getInstance())).start();
    new Thread(() -> System.out.println(HungrySingleton.getInstance())).start();
    new Thread(() -> System.out.println(HungrySingleton.getInstance())).start();
    new Thread(() -> System.out.println(HungrySingleton.getInstance())).start();
    new Thread(() -> System.out.println(LazySingleton.getInstance())).start();
    new Thread(() -> System.out.println(LazySingleton.getInstance())).start();
    new Thread(() -> System.out.println(LazySingleton.getInstance())).start();
    new Thread(() -> System.out.println(LazySingleton.getInstance())).start();
    new Thread(() -> System.out.println(LazySingleton.getInstance())).start();
  }
}
